﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing.Drawing2D;

namespace ImageRecognition2.Action
{
    /// <summary>
    /// Used to set interpolation mode to a picture box
    /// </summary>
    public class ActionInterpolationMode : AbstractCommand
    {
        private InterpolationMode m_InterpolationMode = InterpolationMode.NearestNeighbor;

        /// <summary>
        /// Initializes a new instance of the <see cref="ActionInterpolationMode"/> class.
        /// </summary>
        /// <param name="_interpolationMode">The _interpolation mode.</param>
        public ActionInterpolationMode(InterpolationMode _interpolationMode)
        {
            m_InterpolationMode = _interpolationMode;
        }

        /// <summary>
        /// Runs the specified sender.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        public override void Run(object sender, EventArgs e)
        {
            MainFormSingleton.ActivePictureBox.InterpolationMode = m_InterpolationMode;
            MainFormSingleton.ActivePictureBox.Invalidate();
        }

        /// <summary>
        /// Gets or sets the interpolation mode.
        /// </summary>
        /// <value>The interpolation mode.</value>
        public InterpolationMode InterpolationMode
        {
            get { return m_InterpolationMode; }
            set { m_InterpolationMode = value; }
        }
    }
}
